home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / dragon-runner.swf / scripts / ItemChar.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  2.9 KB  |  114 lines

  1. package
  2. {
  3.    import flash.display.MovieClip;
  4.    import flash.events.Event;
  5.    
  6.    public class ItemChar extends MovieClip
  7.    {
  8.        
  9.       
  10.       private var ┬º\x01\x01\x02\t┬º:*;
  11.       
  12.       private var ┬º\x01\x01\x0b\n┬º:String;
  13.       
  14.       internal const UPPERBORDER:* = 150;
  15.       
  16.       private var ┬º\x01\x01\x0b\x0b┬º:int = 50;
  17.       
  18.       private var ┬º\x01\x01\x06\r┬º:*;
  19.       
  20.       private var ┬º\x01\x01\x0b\f┬º:* = null;
  21.       
  22.       private var ┬º\x01\x01\x0b\r┬º:Number = 30;
  23.       
  24.       internal const DIM:* = 30;
  25.       
  26.       internal const VSPEED:* = 30;
  27.       
  28.       internal const LOWERBORDER:* = 250;
  29.       
  30.       private var ┬º\x01\x01\x0b\x0f┬º:Number = 5;
  31.       
  32.       internal const HSPEED:* = 5;
  33.       
  34.       public function ItemChar()
  35.       {
  36.          ┬º\x01\x01\x0b\f┬º = null;
  37.          ┬º\x01\x01\x0b\x0b┬º = 50;
  38.          ┬º\x01\x01\x0b\x0f┬º = HSPEED;
  39.          ┬º\x01\x01\x0b\r┬º = VSPEED;
  40.          super();
  41.       }
  42.       
  43.       public function GetCharType() : String
  44.       {
  45.          return "item";
  46.       }
  47.       
  48.       public function Init(param1:*, param2:*, param3:*, param4:*) : *
  49.       {
  50.          ┬º\x01\x01\x02\t┬º = param1;
  51.          ┬º\x01\x01\x06\r┬º = param2;
  52.          ┬º\x01\x01\x0b\f┬º = param3;
  53.          ┬º\x01\x01\x0b\n┬º = param4;
  54.          this.x = -(Math.random() * 500);
  55.          this.y = UPPERBORDER + 10;
  56.          this.width = DIM;
  57.          this.height = DIM;
  58.          if(param4 == "full")
  59.          {
  60.             ┬º\x01\x01\x0b\x0f┬º = HSPEED * 3;
  61.          }
  62.          else
  63.          {
  64.             ┬º\x01\x01\x0b\x0f┬º = HSPEED;
  65.          }
  66.          ┬º\x01\x01\x0b\x0e┬º(┬º\x01\x01\x0b\n┬º);
  67.          ┬º\x01\x01\x02\t┬º.addEventListener(Event.ENTER_FRAME,┬º\x01\x01\x06\x0e┬º,false,0,true);
  68.       }
  69.       
  70.       public function GetHealthDamage() : int
  71.       {
  72.          if(┬º\x01\x01\x0b\n┬º == "health" || ┬º\x01\x01\x0b\n┬º == "full")
  73.          {
  74.             return ┬º\x01\x01\x0b\x0b┬º;
  75.          }
  76.          return 0;
  77.       }
  78.       
  79.       public function GetArmorDamage() : int
  80.       {
  81.          if(┬º\x01\x01\x0b\n┬º == "armor" || ┬º\x01\x01\x0b\n┬º == "full")
  82.          {
  83.             return ┬º\x01\x01\x0b\x0b┬º;
  84.          }
  85.          return 0;
  86.       }
  87.       
  88.       private function ┬º\x01\x01\x0b\x0e┬º(param1:String) : *
  89.       {
  90.          gotoAndPlay(param1);
  91.          if(param1 == "speed")
  92.          {
  93.             ┬º\x01\x01\x0b\x0b┬º = 0;
  94.          }
  95.       }
  96.       
  97.       private function ┬º\x01\x01\x06\x0e┬º(param1:Event) : *
  98.       {
  99.          this.x += ┬º\x01\x01\x0b\x0f┬º;
  100.          this.y = Math.sin(this.x / 51) * (LOWERBORDER - UPPERBORDER) + UPPERBORDER;
  101.          if(this.x > 640)
  102.          {
  103.             Destroy();
  104.          }
  105.       }
  106.       
  107.       public function Destroy() : *
  108.       {
  109.          ┬º\x01\x01\x02\t┬º.removeEventListener(Event.ENTER_FRAME,┬º\x01\x01\x06\x0e┬º);
  110.          ┬º\x01\x01\x0b\f┬º.RemoveItem();
  111.       }
  112.    }
  113. }
  114.